package com.ydd.controller.admin;

import com.ydd.dto.AdvimgDTO;
import com.ydd.dto.AdvimgPageDTO;
import com.ydd.dto.AdvposDTO;
import com.ydd.dto.AdvposdPageDTO;
import com.ydd.result.Result;
import com.ydd.service.YddAdvimgService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "广告图管理")
@RequestMapping("/ydd_advimg")
public class AdvimgController {

    @Autowired
    private YddAdvimgService advimgService;

    /**
     * 广告图分页
     * @param dto
     * @return
     */
    @GetMapping("/list")
    public Result pageList(AdvimgPageDTO dto){

        return advimgService.pageList(dto);

    }
    /**
     * 根据id查询
     *
     * @return
     */
    @GetMapping("/rowInfo")
    public Result selectByAdvimgId(Long id) {

        return advimgService.selectByAdvimgId(id);
    }

    /**
     * 修改
     *
     * @return
     */
    @PostMapping("/update")
    public Result updateAdvimg(@RequestBody AdvimgDTO dto) {

        return advimgService.updateAdvimg(dto);
    }
    /**
     * 根据id删除
     * @return
     */
    @GetMapping("/del")
    public Result delAdvimg(Long id){

        return  advimgService.delAdvimg(id);

    }

    /**
     * 添加
     * @return
     */
    @PostMapping("/add")
    public Result addAdvimg(@RequestBody AdvimgDTO dto){

        return advimgService.addAdvimg(dto);

    }
}
